/**
 * axios 请求
 * @author nikolatesfei
 * 
 */
import axios from './axiosfilter'
export default function fetch(url, params,type='post') {
    return new Promise((resolve, reject) => {
    	var ax = axios;
    	switch(type){
    		case "put":
    			ax = ax.put(url, params);
    		break;
    		case "delete":
    			ax = ax.delete(url, {params:params});
    		break;
    		case "post":
    			ax = ax.post(url, params);
    		break;
    		case "get":
    			ax = ax.get(url, {params : params});
    		break;
    	}
    	ax.then(response => {
            resolve(response.data);
        }, err => {
            reject(err);
        })
        .catch((error) => {
            reject(error)
        })
    })
}